Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed basedocs.jl (temporarily pushed off) and logging.jl to only use jldoctest #57840

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

persinammon4
Copy link
Contributor

#56921

Small update of two files (logging.jl and basedocs.jl) to switch from julia-repl tag to jldoctest tags.

Would prefer for reviewer to double check that make -C doc doctest=true works for them

@LilithHafner
Copy link
Member

You can look at the doctest failures (in the check job) to see where this still needs work. It's safe for you to ignore all the other CI checks for this PR.

Take a look at https://documenter.juliadocs.org/stable/man/doctests/#Filtering-Doctests for how to handle those undef examples.

@LilithHafner
Copy link
Member

I'd use a filter that only filters out floating point values, not the whole output. e.g. -?\d+\.\d+(e-?\d+)?|NaN|Inf|-Inf

@persinammon4
Copy link
Contributor Author

Hi @LilithHafner, so zero regex works, but even the basic regex with or without being raw string is throwing an error for me.

Currently, I'm at this error: LoadError("sysimg.jl", 5, LoadError("Base.jl", 279, LoadError("docs/basedocs.jl", 4, LoadError("docs/basedocs.jl", 2898, ErrorException("parsing command jldoctest; filter = r\"(-?\\s*-?\\d\\.\\d+e[+-]?\\d+\\n)+|NaN|Inf|-Inf\"\njulia> Vector{Float64}(undef, 3)\n3-element Vector{Float64}:\n 6.90966e-310\n 6.90966e-310\n 6.90966e-310\n: special characters \"#{}()[]<>|&*?~;\" must be quoted in commands"))))) for this line of code

jldoctest; filter = "-?\\d+\\.\\d+(e-?\\d+)?\\|NaN\\|Inf\\|-Inf".

Have you experienced this error before?

@LilithHafner
Copy link
Member

Right now your escape codes are broken (the regex is within a docstring so you may need double escaping). One thing you can do to get faster feedback is to paste a docstring into the REPL and see if it parses. Right now one of the docstrings in this PR does not parse in a REPL so we can know right away that it won't work. Playing with that might give you a better understanding of escaping.

FYI r"..." is a regex, not a raw string.

You can also grep for examples to see how this is done already:

x@x:~/.julia/dev/julia$ ag "jldoctest; filter"
base/docs/basedocs.jl
1819:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
1961:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
2637:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*\\n.*)*"

base/file.jl
415:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"

base/set.jl
16:```jldoctest; filter = r"^  '.'"ma
107:```jldoctest; filter = r"^  [1234]\$"

base/deprecated.jl
161:```jldoctest; filter = r"@ .*"a

base/idset.jl
14:```jldoctest; filter = r"\\n\\s*(1|1\\.0|true)"

base/essentials.jl
851:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"

base/math.jl
274:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
520:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
555:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
585:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
609:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
648:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
700:```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"

base/meta.jl
258:```jldoctest; filter=r"(?<=Expr\\(:error).*|(?<=Expr\\(:incomplete).*"

base/expr.jl
106:```jldoctest; filter = r"#= .*:6 =#"

doc/src/devdocs/inference.md
97:```jldoctest; filter=r"tuple.jl:\d+"

doc/src/manual/control-flow.md
127:```jldoctest; filter = r"Stacktrace:(\n \[[0-9]+\].*)*"
325:```jldoctest; filter = r"Stacktrace:(\n \[[0-9]+\].*)*"
646:```jldoctest; filter = r"Stacktrace:(\n \[[0-9]+\].*)*"

doc/src/manual/performance-tips.md
1143:```jldoctest; filter = r"[0-9\.]+ seconds \(.*?\)"

doc/src/manual/running-external-programs.md
295:```jldoctest; filter = r"(world\nhello|hello\nworld)"

doc/src/manual/types.md
1196:```jldoctest; filter = r"[0-9\.]+"
1416:```jldoctest; filter = r"Closest candidates.*"s

doc/src/manual/variables.md
65:```jldoctest; filter = r"with \d+ methods"

stdlib/Test/src/Test.jl
1577:```jldoctest; filter = r"trigonometric identities |    4      4  [0-9\\.]+s"

stdlib/UUIDs/src/UUIDs.jl
55:```jldoctest; filter = r"[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}"
180:```jldoctest; filter = r"[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}"

@persinammon4
Copy link
Contributor Author

Sorry!! Assumed that having 1 commit is better than 4. Anyway, I'll resubmit.

"This is an initial switch from julia-repl to jldoctest, as requested here: #56921

Longer term plan is to create a second PR where switch all julia-repl to jldoctest that does not necessarily need filter = regex, then a third for the filter = regex.

Tested with test/corelogging"

@persinammon4 persinammon4 changed the title Changed basedocs.jl and logging.jl to only use jldoctest Changed basedocs.jl (temporarily pushed off) and logging.jl to only use jldoctest Mar 23, 2025
@persinammon4
Copy link
Contributor Author

persinammon4 commented Mar 23, 2025

Use find . -type f -exec grep -l "julia-repl" {} \; to find files with julia-repl.

@LilithHafner
Copy link
Member

Please use a setup block if necessary instead of adding import Logging to the rendered example. This is in the Logging module so we can assume the user has loaded Logging.

@LilithHafner LilithHafner merged commit e50d6fd into JuliaLang:master Mar 25, 2025
7 checks passed
@LilithHafner
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants